import { Component } from '@angular/core';

import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { SQLService } from './sql.service'
import { BackgroundMode } from '@ionic-native/background-mode/ngx';
import { Events } from './events'


@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html'
})
export class AppComponent {
  constructor(
    private platform: Platform,
    private splashScreen: SplashScreen,
    private statusBar: StatusBar,
    private backgroundMode: BackgroundMode,
    private events: Events,
    private sqlService: SQLService,
  ) {
    this.initializeApp();
  }

  initializeApp() {

    this.platform.ready().then(() => {
      this.statusBar.styleDefault();
      this.splashScreen.hide();
      this.sqlService.initDB();
      this.backgroundMode.enable();
      this.backgroundMode.setDefaults({
        title: 'ionictest正在后台运行',
        text: '点击即可进入应用',
        icon: 'assets/img/logo.png'
      })
    });
  }
}
